home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / gedit-2 / plugins / snippets / cpp.xml < prev    next >
Encoding:
Extensible Markup Language  |  2009-04-14  |  5.1 KB  |  184 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <snippets language="cpp">
  3.   <snippet id="main">
  4.     <text><![CDATA[int main (int argc, char const* argv[])
  5. {
  6.     $0
  7.     return 0;
  8. }]]></text>
  9.     <description>main</description>
  10.     <tag>main</tag>
  11.   </snippet>
  12.   <snippet id="for">
  13.     <text><![CDATA[for (${1:unsigned int} ${2:i} = ${3:0}; ${2:i} < ${4:count}; ${2:i} += ${5:1})
  14. {
  15.     $0
  16. }]]></text>
  17.     <description>for loop</description>
  18.     <tag>for</tag>
  19.   </snippet>
  20.   <snippet id="beginend">
  21.     <text><![CDATA[${1:v}.begin(), ${1:v}.end()]]></text>
  22.     <description>$1.begin</description>
  23.     <tag>beginend</tag>
  24.   </snippet>
  25.   <snippet id="do">
  26.     <text><![CDATA[do
  27. {
  28.     $0
  29. } while ($1 );]]></text>
  30.     <description>do .. while</description>
  31.     <tag>do</tag>
  32.   </snippet>
  33.   <snippet id="endif">
  34.     <text><![CDATA[#endif
  35. $0]]></text>
  36.     <accelerator><![CDATA[<Control><Alt>period]]></accelerator>
  37.     <description>#endif</description>
  38.   </snippet>
  39.   <snippet id="if">
  40.     <text><![CDATA[if (${1:condition})
  41. {
  42.     $0
  43. }]]></text>
  44.     <description>if ..</description>
  45.     <tag>if</tag>
  46.   </snippet>
  47.   <snippet id="inc">
  48.     <text><![CDATA[#include "${1:file}"
  49. $0]]></text>
  50.     <description>#include ".."</description>
  51.     <tag>inc</tag>
  52.   </snippet>
  53.   <snippet id="Inc">
  54.     <text><![CDATA[#include <${1:file}>
  55. $0]]></text>
  56.     <description>#include <..></description>
  57.     <tag>Inc</tag>
  58.   </snippet>
  59.   <snippet id="namespace">
  60.     <text><![CDATA[namespace ${1:ns}
  61. {
  62.     $0
  63. };
  64. ]]></text>
  65.     <description>namespace ..</description>
  66.     <tag>namespace</tag>
  67.   </snippet>
  68.   <snippet id="readfile">
  69.     <text><![CDATA[std::vector<uint8_t> v;
  70. if (FILE* fp = fopen (${1:"filename"}, "r"))
  71. {
  72.     uint8_t buf[1024];
  73.     while (size_t len = fread (buf, 1, sizeof (buf), fp))
  74.         v.insert (v.end(), buf, buf + len);
  75.     fclose(fp);
  76. }
  77. $0]]></text>
  78.     <description>Read File Into Vector</description>
  79.     <tag>readfile</tag>
  80.   </snippet>
  81.   <snippet id="map">
  82.     <text><![CDATA[std::map<${1:key}, ${2:value}> ${3:map};
  83. $0]]></text>
  84.     <description>std::map</description>
  85.     <tag>map</tag>
  86.   </snippet>
  87.   <snippet id="vector">
  88.     <text><![CDATA[std::vector<${1:char}> ${2:v};
  89. $0]]></text>
  90.     <description>std::vector</description>
  91.     <tag>vector</tag>
  92.   </snippet>
  93.   <snippet id="struct">
  94.     <text><![CDATA[struct ${1:name}
  95. {
  96.     ${0:/* data */}
  97. };]]></text>
  98.     <description>struct ..</description>
  99.     <tag>struct</tag>
  100.   </snippet>
  101.   <snippet id="template">
  102.     <text><![CDATA[template <typename ${1:_InputIter}>]]></text>
  103.     <description>template <typename ..></description>
  104.     <tag>template</tag>
  105.   </snippet>
  106.   <snippet id="gpl">
  107.     <text><![CDATA[/*
  108.  * ${1:[$GEDIT_BASENAME,<filename>]}
  109.  * This file is part of ${2:<program name>}
  110.  *
  111.  * Copyright (C) $<3: import datetime; return str(datetime.date.today().year)> - $<4:
  112. import pwd, os
  113. try:
  114.   return pwd.getpwuid(os.getuid()).pw_gecos.split(',')[0]
  115. except KeyError:
  116.   return '<author\>' >
  117.  *
  118.  * ${2} is free software; you can redistribute it and/or modify
  119.  * it under the terms of the GNU General Public License as published by
  120.  * the Free Software Foundation; either version 2 of the License, or
  121.  * (at your option) any later version.
  122.  *
  123.  * ${2} is distributed in the hope that it will be useful,
  124.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  125.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  126.  * GNU General Public License for more details.
  127.  *
  128.  * You should have received a copy of the GNU General Public License
  129.  * along with ${2}; if not, write to the Free Software
  130.  * Foundation, Inc., 51 Franklin St, Fifth Floor, 
  131.  * Boston, MA  02110-1301  USA
  132.  */
  133.  
  134.  $0]]></text>
  135.     <tag>gpl</tag>
  136.     <description>GPL License</description>
  137.   </snippet>
  138.   <snippet id="lgpl">
  139.     <text><![CDATA[/*
  140.  * ${1:[$GEDIT_BASENAME,<filename>]}
  141.  * This file is part of ${2:<library name>} 
  142.  *
  143.  * Copyright (C) $<3: import datetime; return str(datetime.date.today().year)> - $<4:
  144. import pwd, os
  145. try:
  146.   return pwd.getpwuid(os.getuid()).pw_gecos.split(',')[0]
  147. except KeyError:
  148.   return '<author\>' >
  149.  *
  150.  * ${2} is free software; you can redistribute it and/or
  151.  * modify it under the terms of the GNU Lesser General Public
  152.  * License as published by the Free Software Foundation; either
  153.  * version 2.1 of the License, or (at your option) any later version.
  154.  * 
  155.  * ${2} is distributed in the hope that it will be useful,
  156.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  157.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  158.  * Lesser General Public License for more details.
  159.  * 
  160.  * You should have received a copy of the GNU Lesser General Public
  161.  * License along with this library; if not, write to the Free Software
  162.  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  163.  */
  164.  
  165.  $0]]></text>
  166.     <tag>lgpl</tag>
  167.     <description>LGPL License</description>
  168.   </snippet>
  169.   <snippet id="td">
  170.     <text><![CDATA[typedef ${1:newtype} ${2:type};
  171. $0]]></text>
  172.     <tag>td</tag>
  173.     <description>typedef</description>
  174.   </snippet>
  175.   <snippet id="while">
  176.     <text><![CDATA[while ($1)
  177. {
  178.     $0
  179. }]]></text>
  180.     <tag>while</tag>
  181.     <description>while</description>
  182.   </snippet>
  183. </snippets>
  184.